Bullet = function(x,y,theta, color){
    this.x = x;
    this.y = y;
    this.angle = theta;
    this.speed = 1500;
    this.color = color;
    this.size = 4;
				
    this.update = function(length, keysDown){
        //move in the direction of the angle
        var dx = length*this.speed*Math.cos(this.angle);
        var dy = length*this.speed*Math.sin(this.angle);
		
        this.x = this.x + dx;
        this.y = this.y + dy;
        //point,angle,length
    }
    this.draw = function(context){
        //also turned at the correct angle
        context.save();
        context.translate(this.x,this.y);
        context.rotate(this.angle);
        context.fillStyle = this.color;
        context.fillRect(-this.size/2, -this.size/2, this.size, this.size);
        context.restore();
    }
    this.remove = function(canvas){
        //also turned at the correct angle
        if(this.x > canvas.width || this.x < 0 || this.y < 0 || this.y > canvas.height){
            return true;
        }else{
            return false;
        }
    }
}
